//
//  ScondViewController.m
//  导航控制器
//
//  Created by apple on 15/9/16.
//  Copyright (c) 2015年 戴维营. All rights reserved.
//

#import "ScondViewController.h"

@interface ScondViewController ()

@end

@implementation ScondViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    self.view.backgroundColor = [UIColor yellowColor];
    
    CGSize size = self.view.frame.size;
    
    
    
    //导航条
    
    //左
    
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"左侧" style:UIBarButtonItemStylePlain target:self action:@selector(didc:)];
#if 0
    //右
    
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"234"] style:UIBarButtonItemStylePlain target:self action:@selector(didc:)];
#endif
  
#if 1
    
    //右
    
    //如果需要渲染显示图片的原始模样，需要设置渲染模式
    
    UIImage *image = [UIImage imageNamed:@"234"];
    
    image = [image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithImage:image style:UIBarButtonItemStylePlain target:self action:@selector(didc:)];
    
#endif
    //导航条的高度
    
//    UIView *v = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 60)];
//    
//    v.backgroundColor = [UIColor whiteColor];
    
//    self.navigationItem.titleView = v;
    
    //当标题和titleView有冲突的时候，只会有一个生效。
    
    self.title = @"这是标题";
    
    
    
    _button = [[UIButton alloc] initWithFrame:CGRectMake(60, 120, 300, 70)];
    
    [_button addTarget:self action:@selector(didc:) forControlEvents:UIControlEventTouchUpInside];
    
    [_button setTitle:@"进入第三个页面" forState:UIControlStateNormal];
    
    [_button setTitleColor:[UIColor redColor] forState:UIControlStateNormal];
    
    [self.view addSubview:_button];
    
    
    //返回上一层；
    UIButton *but = [[UIButton alloc] initWithFrame:CGRectMake(60, 250, 200, 70)];
    
    [but setTitle:@"返回上一个页面" forState:UIControlStateNormal];
    
    
    
    
    
}

- (void)didc:(UIButton *)sender
{
    ThreeViewController *threeView = [[ThreeViewController alloc] init];
    
    [self.navigationController pushViewController:threeView animated:YES];
}

- (void)dealloc
{
    NSLog(@"%s",__func__);
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
@end
